(function($, window) {
    var starttx, startty;
    var tabClick = function(element, options) {
        this.$element = $(element);
        this.init();
    }
    tabClick.prototype = {
        init: function() {

            var tabDiv = this.$element.parent().parent();
            if (tabDiv.hasClass('tab_nav_swipe')) {
                this.$element.on('click', this.toggle);
            } else {
                this.$element.on('touchstart', this.toggle);
                this.$element.on('touchend', this.toggle);
                this.$element.on('mousedown', this.toggle);
                this.$element.on('mouseup', this.toggle);
            }
        },
        toggle: function() {
            $(this).find('a').addClass('active');
            $(this).siblings().find('a').removeClass('active');
        }
    }
    $.fn.tabclick = function(options) {
        return this.each(function() {
            this.__tabItem = new tabClick(this, options);
            return;
        });
    };
})(window.Zepto, window);